package com.bianmaba.examples.bean.order;

import com.bianmaba.spring.data.jpa.domain.annotations.QueryCacheable;
import com.bianmaba.spring.data.jpa.domain.entity.UuidIdentityEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

@DynamicUpdate(true)
@DynamicInsert(true)
@Entity
@Table(name = "[order]")
//此注解重新定义为是否开启查询缓存
@QueryCacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Order extends UuidIdentityEntity {
    @Column(nullable = false)
    private String number;
    @Column(nullable = false)
    private Double total;
    @Column(nullable = false, updatable = false)
    private Long cdt = System.currentTimeMillis();

    public Long getCdt() {
        return cdt;
    }

    public void setCdt(Long cdt) {
        this.cdt = cdt;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public Double getTotal() {
        return total;
    }

    public void setTotal(Double total) {
        this.total = total;
    }
}
